<!DOCTYPE HTML>
<html lang="utf-8">
<head>
<meta charset="utf-8">
<title>驾车宝典-${viewMember.nickName!}的话题</title>
<link href="${ctx}/styles/group.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/userPanel.css" rel="stylesheet" type="text/css">
<#include '/baseHead.ftl'>
<!--主要部分开始-->
<section id="main"><div class="bgA_01">
	
	<div class="userNavPanel_03"><div class="bgP_01">
		<#include 'setting.ftl'>
	</div></div>
	
	<div class="userChangePasswordPanel_01"><!--这个功能块里的button标签可根据需要在 span button a 三种标签中调换-->
		<div class="textField">
			<p>为了您的帐号安全，建议使用尽量复杂的密码，例如数字+字母的组合，最少6个字符。</p>
		</div>
		<div class="listField">
			<dl>
				<dt>旧密码：</dt>
				<dd><input type="password" id="password" class="txt"></dd>
				<dd id="errora"><em>前后密码不一致</em></dd>
			</dl>
			<dl>
				<dt>新密码：</dt>
				<dd><input type="password" id="repassword" class="txt"></dd>
				<dd><em>密码包含非法字符</em></dd>
			</dl>
			<dl>
				<dt>确认密码：</dt>
				<dd><input type="password" id="repassword2"class="txt"></dd>
				<dd id="error"><em>密码输入不正确</em></dd>
			</dl>
		</div>
		<div class="submitField">
			<button class="btn btn1" onclick='submit()' title="点击修改">修改密码</button>
			<!-- <button class="btn btn1" title="取消">取消</button> -->
		</div>
	</div>
					
<#include '/commonFriendLink.ftl'>
	<!--<iframe src="/freemarker/setpage/choosehead.html" name="if1" id="if1" scrolling="no" width="600" height="250" frameborder="0"></iframe>-->

</div></section>
<!--主要部分结束-->
<#include '/baseFoot.ftl'>

<script>
function submit(){
	var password =  $('#password').val() ;
	if ( password == ""){
		alert("没密码不安全哦亲");
		return ;
	}else if ( password.length>30){
		alert("这么长的密码你记得住？");
			return ;
	}
	var repassword =  $('#repassword').val() ;
	if ( repassword == ""){
		alert("没密码不安全哦亲");
			return ;
	}else if ( repassword.length>30){
		alert("这么长的密码你记得住?");
			return ;
	}else if ( repassword.length < 6 ){
		alert("密码太短了!");
			return 
	}
	
	var repassword2 =  $('#repassword2').val() ;
	if ( repassword2 == ""){
		alert("没密码不安全哦亲");
			return ;
	}else if ( repassword2.length>30){
		alert("这么长的密码你记得住？");
			return ;
	}else if ( repassword2.length < 6 ){
		alert("密码太短了!");
			return 
	}
	
	if ( repassword2 != repassword ){
			alert("2次输入的密码不一致");
				return ;
	}
	$.ajax({
		 			type: "get",
					url: "${ctx}/member/changePasswordAction",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						if ( data.state == 1 ) {
							alert("密码修改成功");
							window.location.reload();
						}else{
							alert(data.desc);
						}
					},
					data:{
						"newPassword":repassword,
						"oldPassword":password
					},
					dataType:'json'
				}
	 		)
}
</script>